home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-03-29 | 6.4 KB | 69 lines | [TEXT/ALFA] |
- \ Section: ProDOS Traps
-
- \ *
- \ *
- \ * Link external monitor and ProDOS routines to simulator
- \ * via unused opcodes placed in memory at the locations
- \ * indicated.
- \ *
- \ *
-
-
- \ ProDOS MLI command - all disk access accomplished through here ($FF)
- \
- \ This section uses Mops specific file access of necessity.
- \ Modify appropriately for other systems.
- \
-
- \ QForth allows up to three open files
-
- File f0 \ Mops file objects
- File f1
- File f2
- File temp \ used by fcreate to preserve already open files
-
- String fname \ general purpose file name (new: in initialize)
-
- variable func \ ProDOS MLI command code
- variable params \ address of parameter table
-
- \ Support words
-
- \ N.B. ProDOS names are <length><text> format
- : getName ( addr -- ) \ put the filename in fname
- release: fname new: fname \ clear it
- dup c@ swap 1+ swap put: fname
- ;
-
- variable pushT
- : pushQF ( n -- ) \ push n on the QForth stack
- pushT ! F4 $@ 1+ F4 $! \ increment stack depth
- pushT 3+ c@ EE $@ 1- AA00 + $! \ store lo byte
- pushT 2+ c@ EE $@ AA00 + $! \ store hi byte
- EE $@ 2- EE $! \ adjust pointer
- ;
-
- : popQF ( -- n ) \ pop n off QForth stack
- F4 $@ 1- F4 $! \ decrement stack depth
- EE $@ 1+ AA00 + $@ \ lo byte
- EE $@ 2+ AA00 + $@ \ hi byte
- 100 * + \ data value
- EE $@ 2+ EE $! \ bump pointer
- dup 7FFF > if 10000 swap - negate then \ correct sign
- ;
-
- : err ( ec -- ) \ error code to accumulator
- abs dup 27 = if drop 4C then rA ! ; \ flag -39 [EOF] as ProDOS EOF
-
- : paramAddr \ return real world address of beginning of params table
- params @ $0000 + ;
-
- : paramName \ return the real world address of the filename
- params @ 1+ $@ params @ 2+ $@ 100 * + $0000 + ;
-
- : getFileName \ put the ProDOS file name in fname
- paramName getName ;
-
- \ Individual ProDOS commands
-